import java.util.Scanner;

public class Ex6_1{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		System.out.print("Enter the number of students: ");
		int num = input.nextInt();
		System.out.printf("Enter %d scores: ", num);
		// the limit of an array can be variable
		double[] score = new double[num];
		double best = -1;
		for (int i = 0; i < num; i++){
			score[i] = input.nextDouble();
			if (score[i] > best)
				best = score[i];
		}
		for (int i = 0; i < num; i++){
			if (score[i] >= best - 10)
				System.out.printf("Student %d score is %.0f and grade is A\n",
									i, score[i]);
			else if (score[i] >= best - 20)
				System.out.printf("Student %d score is %.0f and grade is B\n",
									i, score[i]);
			else if (score[i] >= best - 30)
				System.out.printf("Student %d score is %.0f and grade is C\n",
									i, score[i]);
			else
				System.out.printf("Student %d score is %.0f and grade is D\n",
									i, score[i]);
		}

	}
}